/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package EntityBeans;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;

/**
 *
 * @author Keith Augustsson
 */
@Embeddable
public class CanbePK implements Serializable {
    @Basic(optional = false)
    @Column(name = "tripNr")
    private String tripNr;
    @Basic(optional = false)
    @Column(name = "otherAirline")
    private String otherAirline;
    @Basic(optional = false)
    @Column(name = "otherFlight")
    private String otherFlight;

    public CanbePK(String tripNr, String otherAirline, String otherFlight) {
        this.tripNr = tripNr;
        this.otherAirline = otherAirline;
        this.otherFlight = otherFlight;
    }

    public String getTripNr() {
        return tripNr;
    }

    public void setTripNr(String tripNr) {
        this.tripNr = tripNr;
    }

    public String getOtherAirline() {
        return otherAirline;
    }

    public void setOtherAirline(String otherAirline) {
        this.otherAirline = otherAirline;
    }

    public String getOtherFlight() {
        return otherFlight;
    }

    public void setOtherFlight(String otherFlight) {
        this.otherFlight = otherFlight;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (tripNr != null ? tripNr.hashCode() : 0);
        hash += (otherAirline != null ? otherAirline.hashCode() : 0);
        hash += (otherFlight != null ? otherFlight.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CanbePK)) {
            return false;
        }
        CanbePK other = (CanbePK) object;
        if ((this.tripNr == null && other.tripNr != null) || (this.tripNr != null && !this.tripNr.equals(other.tripNr))) {
            return false;
        }
        if ((this.otherAirline == null && other.otherAirline != null) || (this.otherAirline != null && !this.otherAirline.equals(other.otherAirline))) {
            return false;
        }
        if ((this.otherFlight == null && other.otherFlight != null) || (this.otherFlight != null && !this.otherFlight.equals(other.otherFlight))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "EntityBeans.CanbePK[tripNr=" + tripNr + ", otherAirline=" + otherAirline + ", otherFlight=" + otherFlight + "]";
    }

}
